import { APPCONFIG } from '../constants/appconfig'
import { setCache, getCache } from "../utils/cache";
import { APP_CACHE_KEY } from '../service/config'
const INITIAL_STATE = getCache(APP_CACHE_KEY);

export default function appconfig(state = INITIAL_STATE, action) {
  switch (action.type) {
    case APPCONFIG:
      setCache(APP_CACHE_KEY, {
        ...state,
        ...action
      })
      return {
        ...state,
        ...action
      }
    default:
      return {...state}
  }
}
